cmake_minimum_required (VERSION 3.8)

set(INTERCEPT_EXAMPLE_NAME "intercept_client")


intercept_set_linker_options()

option(USE_ENGINE_TYPES "USE_ENGINE_TYPES" OFF)

if(USE_ENGINE_TYPES)
    add_definitions(/DINTERCEPT_SQF_STRTYPE_RSTRING)
endif()


add_definitions(/DNOMINMAX)
add_definitions(/DINTERCEPT_NO_THREAD_SAFETY)

set(INTERCEPT_NAME "intercept_client")

file(GLOB INTERCEPT_CLIENT_SOURCES *.c *.cpp)
file(GLOB INTERCEPT_CLIENT_HEADERS ../headers/*.h ../headers/*.hpp)

file(GLOB INTERCEPT_CLIENT_MAIN_SOURCES  ./client/*.c ./client/*.cpp)
file(GLOB INTERCEPT_CLIENT_MAIN_HEADERS  ../headers/client/*.h ../headers/client/*.hpp)

file(GLOB INTERCEPT_CLIENT_SHARED_SOURCES  ./shared/*.c ./shared/*.cpp)
file(GLOB INTERCEPT_CLIENT_SHARED_HEADERS  ../headers/shared/*.h ../headers/shared/*.hpp)

file(GLOB INTERCEPT_CLIENT_SQF_SHARED_HEADERS  ./client/sqf/*.c ./client/sqf/*.cpp)
file(GLOB INTERCEPT_CLIENT_SQF_SHARED_SOURCES  ../headers/client/sqf/*.h ../headers/client/sqf/*.hpp)


SOURCE_GROUP("intercept_client" FILES  ${INTERCEPT_CLIENT_SOURCES} ${INTERCEPT_CLIENT_HEADERS})
SOURCE_GROUP("intercept_client\\client" FILES ${INTERCEPT_CLIENT_MAIN_SOURCES} ${INTERCEPT_CLIENT_MAIN_HEADERS})
SOURCE_GROUP("intercept_client\\shared" FILES ${INTERCEPT_CLIENT_SHARED_SOURCES} ${INTERCEPT_CLIENT_SHARED_HEADERS})
SOURCE_GROUP("intercept_client\\client\\sqf" FILES ${INTERCEPT_CLIENT_SQF_SHARED_SOURCES} ${INTERCEPT_CLIENT_SQF_SHARED_HEADERS})



add_library( ${INTERCEPT_EXAMPLE_NAME} STATIC ${INTERCEPT_CLIENT_SOURCES} ${INTERCEPT_CLIENT_HEADERS} ${INTERCEPT_CLIENT_MAIN_SOURCES} ${INTERCEPT_CLIENT_MAIN_HEADERS} ${INTERCEPT_CLIENT_SHARED_SOURCES} ${INTERCEPT_CLIENT_SHARED_HEADERS} ${INTERCEPT_CLIENT_SQF_SHARED_SOURCES} ${INTERCEPT_CLIENT_SQF_SHARED_HEADERS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} "../headers")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} "../headers/shared")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} "../headers/client")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} "../headers/client/sqf")

target_link_libraries(${INTERCEPT_EXAMPLE_NAME} ${LINK_LIBS})
set_target_properties(${INTERCEPT_EXAMPLE_NAME} PROPERTIES PREFIX "")
set_target_properties(${INTERCEPT_EXAMPLE_NAME} PROPERTIES FOLDER intercept_client)
set_target_properties(${INTERCEPT_EXAMPLE_NAME} PROPERTIES 
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/intercept_client"
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/intercept_client"
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/intercept_client")

if(CMAKE_COMPILER_IS_GNUCXX)
    set_target_properties(${INTERCEPT_EXAMPLE_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
    set_target_properties(${INTERCEPT_EXAMPLE_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
endif()
